<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
    xmlns:kiwi="http://www.kiwi-project.eu/jsf"
    xmlns:c="http://java.sun.com/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:a="http://richfaces.org/a4j">


		<style>
	        .inplace{
	            border: none;
	            cursor:pointer; 
	        }
	        .hover {
	            color: #{a4jSkin.generalTextColor};
	            background-color :#{a4jSkin.tipBorderColor};
	        }   
		   
		   .typelist td {
		   		vertical-align: top;
		   }
	    </style> 
		
		<h1>Property perspective for<h:outputText value=" "/><h:outputText property="http://www.kiwi-project.eu/kiwi/core/title"/></h1>
		
		<p style="margin-top: 20px; margin-left: 10px; margin-right: 10px;" class="help">
		  The content item currently displayed represents either an RDFS or an OWL property. Using this perspective,
		  you can get additional property related information about the content item, i.e. the sub- and superproperties, range, domain, etc.
		  When you switch to "edit" mode, some of this information can also be edited. Note that inferred metadata is listed 
		  separately. When hovering the mouse over inferred data, an explanation justifying its existance is displayed.
		</p>

		<br/>

		<!-- list of superproperties (needs proper layouting) -->
		<p:panel header="Superproperties" footer="The currently displayed item is in a rdfs:subPropertyOf relation with the resources listed above.">
	    	<strong>Base:</strong><br/>
			<c:forEach items="#{ontologyService.listSuperProperties(contentItem.resource,false)}" var="sc" varStatus="status">
	    		<h:outputLink value="#{configurationService.baseUri}/home.seam?kiwiid=#{kiwi.ui.utility.encodeURL(sc.kiwiIdentifier)}">
					<h:outputText value="#{sc.label} (#{sc.namespacePrefix})" />
				</h:outputLink>
				<c:if test="#{not status.last}">,<h:outputText value=" "/></c:if>
	    	</c:forEach>
			<br/>
	    	<strong>Inferred:</strong><br/>
			<c:forEach items="#{ontologyService.listSuperProperties(contentItem.resource,true)}" var="sc" varStatus="status">
                <s:link view="/home.xhtml" value="#{sc.label} (#{sc.namespacePrefix})"  propagation="none">
                    <f:param name="title"/><f:param name="uri"/><f:param name="id" /><f:param name="kiwiid" value="#{sc.kiwiIdentifier}"/>
                    <rich:toolTip attached="true" layout="block">
			            <f:facet name="defaultContent">
			                <strong>Please wait...</strong>
			            </f:facet>
                
						<h:dataTable value="#{explanationService.explainTripleTextually(superpropertyTripleIds.get(sc), true)}" var="story">
						  <h:column>
		                	<h:outputText value="#{story.openingLine.body}" escape="false" style="font-weight:bold"/><h:outputText value=" #{story.openingLine.connective}" style="margin-left:5px"/>
		                	<br/>
						  	<h:dataTable value="#{story.body}" var="line">
						  		<h:column>
						  			<h:outputText value="#{line.body}" escape="false" style="font-weight:bold; margin-left:15px"/> <h:outputText value=" #{line.connective}" style="margin-left:5px"/> <br/>
						  		</h:column>
						  	</h:dataTable>
						  	<br/> <br/>
						  </h:column>
						</h:dataTable>						                
                    </rich:toolTip>    
                </s:link>
				<c:if test="#{not status.last}">,<h:outputText value=" "/></c:if>
	    	</c:forEach>			
		</p:panel>
		
		<br/>

		<!-- list of subclasses (needs proper layouting) -->
		<p:panel header="Subproperties" footer="The resources listed above are in a rdfs:subPropertyOf relation with the currently displayed item (max 100 resources shown).">
	    	<strong>Base:</strong><br/>
	    	<c:forEach items="#{ontologyService.listSubProperties(contentItem.resource,false)}" var="sc" varStatus="status">
	    		<h:outputLink value="#{configurationService.baseUri}/home.seam?kiwiid=#{kiwi.ui.utility.encodeURL(sc.kiwiIdentifier)}">
					<h:outputText value="#{sc.label} (#{sc.namespacePrefix})" />
				</h:outputLink>
				<c:if test="#{not status.last}">,<h:outputText value=" "/></c:if>
	    	</c:forEach>
			<br/>
	    	<strong>Inferred:</strong><br/>
	    	<c:forEach items="#{ontologyService.listSubProperties(contentItem.resource,true)}" var="sc" varStatus="status">
                <s:link view="/home.xhtml" value="#{sc.label} (#{sc.namespacePrefix})"  propagation="none">
                    <f:param name="title"/><f:param name="uri"/><f:param name="id" /><f:param name="kiwiid" value="#{sc.kiwiIdentifier}"/>
                    <rich:toolTip attached="true" layout="block">
			            <f:facet name="defaultContent">
			                <strong>Please wait...</strong>
			            </f:facet>
                
						<h:dataTable value="#{explanationService.explainTripleTextually(subpropertyTripleIds.get(sc), true)}" var="story">
						  <h:column>
		                	<h:outputText value="#{story.openingLine.body}" escape="false" style="font-weight:bold"/><h:outputText value=" #{story.openingLine.connective}" style="margin-left:5px"/>
		                	<br/>
						  	<h:dataTable value="#{story.body}" var="line">
						  		<h:column>
						  			<h:outputText value="#{line.body}" escape="false" style="font-weight:bold; margin-left:15px"/> <h:outputText value=" #{line.connective}" style="margin-left:5px"/> <br/>
						  		</h:column>
						  	</h:dataTable>
						  	<br/> <br/>
						  </h:column>
						</h:dataTable>						                
                    </rich:toolTip>    
                </s:link>
				<c:if test="#{not status.last}">,<h:outputText value=" "/></c:if>
	    	</c:forEach>
		</p:panel>

		<br/>

		<p:panel header="Range" footer="The resources listed above are listed as a rdfs:range of the currently displayed property.">
	    	<strong>Base:</strong><br/>
	    	<c:forEach items="#{ontologyService.listRange(contentItem.resource,false)}" var="sc" varStatus="status">
	    		<h:outputLink value="#{configurationService.baseUri}/home.seam?kiwiid=#{kiwi.ui.utility.encodeURL(sc.kiwiIdentifier)}">
					<h:outputText value="#{sc.label} (#{sc.namespacePrefix})" />
				</h:outputLink>
				<c:if test="#{not status.last}">,<h:outputText value=" "/></c:if>
	    	</c:forEach>
			<br/>
	    	<strong>Inferred:</strong><br/>
	    	<c:forEach items="#{ontologyService.listRange(contentItem.resource,true)}" var="sc" varStatus="status">
                <s:link view="/home.xhtml" value="#{sc.label} (#{sc.namespacePrefix})"  propagation="none">
                    <f:param name="title"/><f:param name="uri"/><f:param name="id" /><f:param name="kiwiid" value="#{sc.kiwiIdentifier}"/>
                    <rich:toolTip attached="true" layout="block">
			            <f:facet name="defaultContent">
			                <strong>Please wait...</strong>
			            </f:facet>
                
						<h:dataTable value="#{explanationService.explainTripleTextually(rangeTripleIds.get(sc), true)}" var="story">
						  <h:column>
		                	<h:outputText value="#{story.openingLine.body}" escape="false" style="font-weight:bold"/><h:outputText value=" #{story.openingLine.connective}" style="margin-left:5px"/>
		                	<br/>
						  	<h:dataTable value="#{story.body}" var="line">
						  		<h:column>
						  			<h:outputText value="#{line.body}" escape="false" style="font-weight:bold; margin-left:15px"/> <h:outputText value=" #{line.connective}" style="margin-left:5px"/> <br/>
						  		</h:column>
						  	</h:dataTable>
						  	<br/> <br/>
						  </h:column>
						</h:dataTable>						                
                </rich:toolTip>    
                </s:link>
				<c:if test="#{not status.last}">,<h:outputText value=" "/></c:if>
	    	</c:forEach>
		</p:panel>
	    
		<br/>    
			
		<p:panel header="Domain" footer="The resources listed above are listed as a rdfs:domain of the currently displayed property.">
	    	<strong>Base:</strong><br/>
	    	<c:forEach items="#{ontologyService.listDomain(contentItem.resource,false)}" var="sc" varStatus="status">
	    		<h:outputLink value="#{configurationService.baseUri}/home.seam?kiwiid=#{kiwi.ui.utility.encodeURL(sc.kiwiIdentifier)}">
					<h:outputText value="#{sc.label} (#{sc.namespacePrefix})" />
				</h:outputLink>
				<c:if test="#{not status.last}">,<h:outputText value=" "/></c:if>
	    	</c:forEach>
			<br/>
	    	<strong>Inferred:</strong><br/>
	    	<c:forEach items="#{ontologyService.listDomain(contentItem.resource,true)}" var="sc" varStatus="status">
                <s:link view="/home.xhtml" value="#{sc.label} (#{sc.namespacePrefix})"  propagation="none">
                    <f:param name="title"/><f:param name="uri"/><f:param name="id" /><f:param name="kiwiid" value="#{sc.kiwiIdentifier}"/>
                    <rich:toolTip attached="true" layout="block">
			            <f:facet name="defaultContent">
			                <strong>Please wait...</strong>
			            </f:facet>
                
						<h:dataTable value="#{explanationService.explainTripleTextually(domainTripleIds.get(sc), true)}" var="story">
						  <h:column>
		                	<h:outputText value="#{story.openingLine.body}" escape="false" style="font-weight:bold"/><h:outputText value=" #{story.openingLine.connective}" style="margin-left:5px"/>
		                	<br/>
						  	<h:dataTable value="#{story.body}" var="line">
						  		<h:column>
						  			<h:outputText value="#{line.body}" escape="false" style="font-weight:bold; margin-left:15px"/> <h:outputText value=" #{line.connective}" style="margin-left:5px"/> <br/>
						  		</h:column>
						  	</h:dataTable>
						  	<br/> <br/>
						  </h:column>
						</h:dataTable>						                
                </rich:toolTip>    
                </s:link>
				<c:if test="#{not status.last}">,<h:outputText value=" "/></c:if>
	    	</c:forEach>
		</p:panel>
		
		<br/>
		
		<!-- Inverse -->
		<p:panel header="Inverse" footer="The currently displayed item has the inverse property (owl:inverseOf) listed above.">
			<c:if test="#{ontologyService.getInverse(contentItem.resource) != null}">
				<c:set var="inverse" value="#{ontologyService.getInverse(contentItem.resource)}" />
	    		<h:outputLink value="#{configurationService.baseUri}/home.seam?kiwiid=#{kiwi.ui.utility.encodeURL(inverse.kiwiIdentifier)}">
					<h:outputText value="#{inverse.label} (#{inverse.namespacePrefix})" />
				</h:outputLink>
			</c:if>
		</p:panel>
		
		<br/>

</ui:composition>
